/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package game1;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.geom.Point2D;



/**
 *
 * @author Юра
 */
public class Dots {
    public boolean armed;
    private double x,y;
    private double vx,vy;
    private Color color = Color.GREEN;

    Dots(Point2D p) {
        this.x = p.getX();
        this.y = p.getY();
    }
    Dots(int x, int y, Color c) {
        this.color = c;
        this.x = x;
        this.y = y;
    }

    public void setColor(Color c) {
        color=c;
    }

    public double get_v(){
        return Point2D.distance(0, 0, vx, vy);
    }

    public void moveTo(Point p) {
        this.x = p.x;
        this.y = p.y;
    }

    public void move() {
        x +=vx;
        y +=vy;
        vx=vx*0.95;
        vy=vy*0.95;
        if (Math.abs(vx)+Math.abs(vy)<5) vx=vy=0;
        //System.out.println(x);
    }

    public void moveTo(int x, int y) {
        this.x =  x;
        this.y =  y;
    }

    public void draw(Graphics2D g2) {
        g2.setColor(color);
        g2.drawLine((int)x, (int)y, (int)x, (int)y);

    }

    public void shotto(Double a, Double speed) {
        vx=speed*Math.cos(a);
        vy=speed*Math.sin(a);
    }

   

}
